package main

import (
	"fmt"
	//	"io"
	"io/ioutil"
	"net/http"
	"os"
)

func main() {
	//	 基本方法
	//	 func (c *Client) Get(url string) (r *Response, err error)
	//	   func (c *Client) Post(url string, bodyType string, body io.Reader) (r *Response, err
	//	   error)
	//	   func (c *Client) PostForm(url string, data url.Values) (r *Response, err error)
	//	   func (c *Client) Head(url string) (r *Response, err error)
	//	   func (c *Client) Do(req *Request) (resp *Response, err error)

	resp, err := http.Get("http://10.42.0.59/health/")
	if err != nil {
		// 处理错误 ...
		return
	}
	defer resp.Body.Close()
	//	io.Copy(os.Stdout, resp.Body)
	body, err := ioutil.ReadAll(resp.Body)
	checkError(err)
	fmt.Println(string(body))
}

func checkError(err error) {
	if err != nil {
		fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error())
	}
}
